package com.ruoyi.flowable.commond;

import java.io.Serializable;

import org.flowable.common.engine.api.FlowableIllegalArgumentException;
import org.flowable.common.engine.impl.interceptor.Command;
import org.flowable.common.engine.impl.interceptor.CommandContext;
import org.flowable.idm.engine.impl.util.CommandContextUtil;

public class DeleteMembershipByGroupIdCmd implements Command<Object>, Serializable {

   private String groupId;

    public DeleteMembershipByGroupIdCmd(String groupId) {
        this.groupId = groupId;
    }

    @Override
    public Object execute(CommandContext commandContext) {
        if (groupId == null) {
            throw new FlowableIllegalArgumentException("groupId is null");
        }
        CommandContextUtil.getMembershipEntityManager(commandContext).deleteMembershipByGroupId(groupId);
        return null;
    }
}
